<template>
  <div>
    <Header></Header>
    <Banner :sightName="sightName" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></Banner>
    <div class="content">
      <List :list="list"></List>
    </div>
  </div>
</template>

<script>
import Banner from './components/Banner.vue'
import Header from './components/Header.vue'
import List from './components/List.vue'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    Banner,
    Header,
    List
  },
  data: function () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallaryImgs: []
    }
  },
  methods: {
    getDetailInfo: function () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then(this.getDetailInfoSucc)
    },
    getDetailInfoSucc: function (res) {
      res = res.data
      if (res.ret && res.data) {
        this.list = res.data.categoryList
        this.sightName = res.data.sightName
        this.bannerImg = res.data.bannerImg
        this.gallaryImgs = res.data.gallaryImgs
      }
    }
  },
  mounted: function () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
